package com.onLineCar.manages.web;

import com.onLineCar.common.core.domain.Result;
import com.onLineCar.common.system.domain.SysFile;
import com.onLineCar.manages.service.FileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;


/**
 * 对象存储是aliyun
 */
@RestController
@RequestMapping("/aliyun")
@Slf4j
public class UploadController {

    @Resource
    private FileService fileService;

    /**
     * 上传文件
     *
     * @param file
     * @return
     */
    @PostMapping("/uploadFile")
    public Result<SysFile> uploadFile(@RequestParam("file") MultipartFile file) {
        return Result.success(fileService.upload(file));
    }


}
